using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SysFrame.Message;
using System.Reflection;

namespace SysFrame.BP
{
    /// <summary>
    /// system_7方法
    /// </summary>
    public class BLLsystem_7
    {
        public Isystem_7 interface_system_7;

        public BLLsystem_7()
        {
            object obj = BPBase.GetAchieve("SysFrame.BP", "system_7");
            interface_system_7 = (Isystem_7)obj;
        }


        /// <summary>
        /// 得到system_7实体
        /// </summary>
        /// <param name="msq">条件</param>
        /// <returns></returns>
        public List<Mssystem_7> Getsystem_7MsByQuery(MsQuery msq)
        {
            return interface_system_7.Getsystem_7MsByQuery(msq);
        }

        /// <summary>
        /// 通过System_7_10得到实体
        /// </summary>
        /// <param name="System_7_10">ID</param>
        /// <returns>实体</returns>
        public Mssystem_7 Getsystem_7MsByKey(string System_7_10)
        {
            MsQuery msquery = new MsQuery();
            try
            {
                msquery.strquery += " and System_7_10='" + System_7_10 + "' ";
                List<Mssystem_7> lstData = Getsystem_7MsByQuery(msquery);
                return lstData[0];
            }
            catch {
                return new Mssystem_7();
            }
        }

        /// <summary>
        ///  保存system_7信息
        /// </summary>
        /// <param name="ms">实体信息</param>
        /// <returns>消息</returns>
        public MsReturned Savesystem_7(Mssystem_7 ms)
        {
            return interface_system_7.Savesystem_7(ms);
        }

        /// <summary>
        /// 得到数据类型
        /// </summary>
        /// <param name="msquery">条件</param>
        /// <returns>数据类型</returns>
        public MsReturned Getsystem_7ByQuery(MsQuery msquery)
        {
            return interface_system_7.Getsystem_7ByQuery(msquery);
        }

        /// <summary>
        /// 删除system_7
        /// </summary>
        /// <param name="msq">条件</param>
        /// <returns></returns>
        public MsReturned Deletesystem_7ByQuery(MsQuery msq)
        {
            return interface_system_7.Deletesystem_7ByQuery(msq);
        }
        /// <summary>
        /// 删除system_7
        /// </summary>
        /// <param name="msq">条件</param>
        /// <returns></returns>
        public MsReturned Deletesystem_7ByKey(string System_7_10)
        {
            MsQuery msquery = new MsQuery();

            if (System_7_10.IndexOf(",") > 0)
            {
                msquery.strquery += " and System_7_10 in (" + System_7_10 + ") ";
            }
            else
            {
                msquery.strquery += " and System_7_10='" + System_7_10 + "' ";
            }
            return interface_system_7.Deletesystem_7ByQuery(msquery);
        }

        /// <summary>
        /// 得到一级菜单
        /// </summary>
        /// <param name="mssys1">用户</param>
        /// <returns></returns>
        public List<Mssystem_7> GetHeadMenuByUser(Mssystem_1 mssys1)
        {
            List<Mssystem_7> listms7 = new List<Mssystem_7>();
            try
            {
                //listms7 = new BLLsystem_7().Getsystem_7MsByQuery(new MsQuery(" and SYSTEM_7_10 in (0," + string.Join(",", mssys1.menuids) + ") and (SYSTEM_7_60 is null or SYSTEM_7_60='null' or SYSTEM_7_60='0' ) "));
                //listms7 = new BLLsystem_7().Getsystem_7MsByQuery(new MsQuery(" and (SYSTEM_7_60 is null or SYSTEM_7_60='null' or SYSTEM_7_60='0' ) "));
                listms7 = new BLLsystem_7().Getsystem_7MsByQuery(new MsQuery(" and SYSTEM_7_10 in (0," + string.Join(",", mssys1.menuids) + ")"));
            }
            catch { }
            return listms7;
        }
    }
}
